package com.yanqu.road.entity.activity.twins.config;

import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class TwinsPvpConfig {

    int activityId;
    int id;
    String recommendPower;
    int icon;
    String name;
    String desc;
    String bossPower;
    int refreshTime;
    String darePoint;
    String rewards;
    String scoreRewards;

    List<String> bossBoolList;
    List<String> bossAttackList;

    //打了多少伤害获得多上声望
    List<Integer> attackDamageList;
    List<Integer> attackScoreList;


    List<Integer> scoreList = new ArrayList<>();
    List<String> rewardList = new ArrayList<>();


    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getRecommendPower() {
        return recommendPower;
    }

    public void setRecommendPower(String recommendPower) {
        this.recommendPower = recommendPower;
    }

    public int getIcon() {
        return icon;
    }

    public void setIcon(int icon) {
        this.icon = icon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getBossPower() {
        return bossPower;
    }

    public void setBossPower(String bossPower) {
        this.bossPower = bossPower;
        List<String> tempBossPowerList = StringUtils.stringToStringList(bossPower,"\\|");
        List<String> bossBoolTempList = new ArrayList<>();
        List<String> bossAttackTempList = new ArrayList<>();
        for(String bossPowerStr : tempBossPowerList){
            List<String> tempList = StringUtils.stringToStringList(bossPowerStr,";");
            bossBoolTempList.add(tempList.get(0));
            bossAttackTempList.add(tempList.get(1));
        }
        this.bossBoolList = bossBoolTempList;
        this.bossAttackList = bossAttackTempList;
    }

    public int getRefreshTime() {
        return refreshTime;
    }

    public void setRefreshTime(int refreshTime) {
        this.refreshTime = refreshTime;
    }

    public String getDarePoint() {
        return darePoint;
    }

    public void setDarePoint(String darePoint) {
        this.darePoint = darePoint;
        List<String> tempDarePointList = StringUtils.stringToStringList(darePoint,"\\|");
        List<Integer> attackDamageTempList = new ArrayList<>();
        List<Integer> attackScoreTempList = new ArrayList<>();
        for(String darePointStr : tempDarePointList){
            List<Integer> tempList = StringUtils.stringToIntegerList(darePointStr,";");
            attackDamageTempList.add(tempList.get(0));
            attackScoreTempList.add(tempList.get(1));
        }
        this.attackDamageList = attackDamageTempList;
        this.attackScoreList = attackScoreTempList;
    }

    public String getRewards() {
        return rewards;
    }

    public void setRewards(String rewards) {
        this.rewards = rewards;
    }

    public String getScoreRewards() {
        return scoreRewards;
    }

    public void setScoreRewards(String scoreRewards) {
        this.scoreRewards = scoreRewards;
        List<String> tempList = StringUtils.stringToStringList(scoreRewards,"\\|");
        for(String tempStr : tempList){
            List<String> tempListSe = StringUtils.stringToStringList(tempStr,"#");
            List<Integer> tempIntList = StringUtils.stringToIntegerList(tempListSe.get(0),",");
            scoreList.add(tempIntList.get(1));
            rewardList.add(tempListSe.get(1));
        }
    }

    private int getDay(long beginTime){
        long todayZeroTime = DateHelper.getTodayZeroTimeStamp();
        long gameZeroTime = DateHelper.getZeroTimeStamp(beginTime * 1000);
        long day = (todayZeroTime - gameZeroTime)/(24 * 60 * 60 * 1000);
        return (int)day;
    }

    public String getBossBool(long beginTime) {
        int day = getDay(beginTime);
        String bool;
        if(day < bossBoolList.size()){
            bool = bossBoolList.get(day);
        }else{
            bool = bossBoolList.get(bossBoolList.size() - 1);
        }
        return bool;
    }

    public String getBossAttack(long beginTime) {
        int day = getDay(beginTime);
        String attack;
        if(day < bossAttackList.size()){
            attack = bossAttackList.get(day);
        }else{
            attack = bossAttackList.get(bossAttackList.size() - 1);
        }
        return attack;
    }

    public int getAttackDamage(long beginTime) {
        int day = getDay(beginTime);
        int attackDamage;
        if(day < attackDamageList.size()){
            attackDamage = attackDamageList.get(day);
        }else{
            attackDamage = attackDamageList.get(attackDamageList.size() - 1);
        }
        return attackDamage;
    }

    public int getAttackScore(long beginTime) {
        int day = getDay(beginTime);
        int attackScore;
        if(day < attackScoreList.size()){
            attackScore = attackScoreList.get(day);
        }else{
            attackScore = attackScoreList.get(attackScoreList.size() - 1);
        }
        return attackScore;
    }

    public List<Integer> getScoreList() {
        return scoreList;
    }

    public List<String> getRewardList() {
        return rewardList;
    }
}
